// TOWN DIALOGUE SCRIPT
//    Town 128: Marish

begintalkscript;

variables;

short i,j,k,r1,choice;

begintalknode;
	tag = 1;
	text1 = "Shayder Ferry is at the middle dock.";
	action = SPEECH_BUBBLE;
	code =
		cs();
		as(1);
	break;


// Yale

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Yale";
	text1 = "You meet the mayor of Marish. He is sitting in his office, the common room of the town inn, looking at some papers. He rises to greet you. _I am Mayor Yale, honored to look after the town of Marish._ He notes your strange appearance with mild distaste.";
	text5 = "Mayor Yale straightens his mayor's sash. He seems to be worried about you. Strangers are rarely fully welcome in these remote towns. Fortunately, he suspects that you might be useful.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 5;
	question = "_How did you become mayor?_";
	text1 = "_It was a great honor. When I was too old to be a sailor, this is where I came to settle down. They liked me here, and the Empire liked me too. So here I am._";

begintalknode;
	state = 5;
	nextstate = -1;
	question = "_Who chose you as mayor?_";
	text1 = "_The Empire. The mayors of Valorim are selected in mighty Blackcrag Fortress, far to the northeast. With hard work, I won their favor._";

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_How fares Marish?_";
	text1 = "_Things have been better. I do the best I can, considering the hard times._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What hard times do you face?_";
	text1 = "_Monsters. What else does anyone have to worry about? Monsters. Undead and giant lizards are harassing us from the north. That's why we've been looking for some adventurers._";
	text3 = "_Well, the local monsters are gone, but we still have to deal with the utter lack of ships coming from the rest of the Empire._ He shrugs. _We'll survive._";
	action = DEP_ON_SDF 128 9 1;

begintalknode;
	state = 3;
	nextstate = -1;
	condition = gf(128,9) <= 1;
	question = "_I might be able to help._";
	code =
		run_hardcode(161);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(128,9) == 1 && gf(58,11) >= 1;
	question = "_The monsters in the cavern to the north will trouble you no more._";
	code =
		run_hardcode(161);
	break;

begintalknode;
	state = 1;
	nextstate = 4;
	condition = gf(128,13) <= 1 && gf(128,9) >= 2;
	question = "_Is there anything else I can do for you?_";
	text1 = "_Well, I hesitated to mention it, since it seems so far below your stature, but a band of brigands has recently taken up residence on the west coast a short distance north of here. They have disrupted travel and such._";
	text2 = "_We need someone to put them to the sword. Should you do that, I can double your payment._";
	action = SET_SDF 128 13 1;
	code =
		toggle_quest(39,1);
	break;
	
begintalknode;
	state = 4;
	nextstate = -1;
	condition = gf(128,13) <= 1;
	question = "_Tell us more about these brigands._";
	text1 = "He looks nervous. _Thieves. Ruffians. Ne'er-do-wells. Showing little loyalty to the Empire. We would all be better off without them. Really._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(245,11) > 0 && gf(245,22) == 0 && gf(128,13) == 1;
	question = "_I met the brigands you told me about. I do not want to fight rebels._";
	text1 = "The mayor is annoyed, and more than a little suspicious. _Not a healthy attitude, outsider. The Empire does not approve of such disloyalty. If you know what's good for you, I suggest you be moving on._";
	action = END_TALK;
	code =
		toggle_quest(39,3);
		sf(128,13,2);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(245,22) >= 1 && gf(128,13) == 1;
	question = "_It is done. The brigands to the north are dead._";
	code =
		run_hardcode(21);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(128,3) >= 2;
	question = "_You said that I killed rebels? You didn't tell me that I was going to fight rebels._";
	text1 = "He looks very nervous. _What? Um, yes. Yes, I did. I was quite explicit on that point. I'm sure of it._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(128,7) >= 1 && gf(128,14) == 0;
	question = "_We found some bodies in the crawlspace behind the inn._";
	text1 = "He shakes his head sadly and dispatches guards to investigate. _I am not surprised. Right by old Marshall's house. She was an odd one. Old. Liked tea. She passed on from a disease caught from a sailor, who'd just come from Shayder._";
	text3 = "_Sailors have disappeared on and off for years around here. Always thought it was the monsters. But it stopped about the time Marshall passed. Now we know why. Thank you for solving this mystery._";
	code =
		sf(128,14,1);
		award_party_xp(100,12);
		change_reputation(1);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(128,13) > 1;
	question = "_Any more work for me?_";
	text1 = "He is increasingly nervous about your presence, but he knows enough to be polite._Not now. Maybe later._";

// Udell

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Udell";
	text1 = "This man is polishing a small statue when you come in. The shop is filled with all sorts of unusual and uninteresting items, from all over Valorim. _I'm Udell._";
	text5 = "Udell grins. _My shop remains here for your perusal._";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_What sort of shop is this?_";
	text1 = "_Welcome to Udell's Miscellany. We have things ships bring from all over. Sell me your stuff, and purchase new stuff to carry around!_";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_Let's do some trading._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Udell's Miscellany","Udell's stock has been painstakingly purchased from a variety of sailors, from all over the world. You suspect that his high quoted prices have something to do with your alien appearance.",56,5,3);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = 1;
	question = "_I would like to sell something._";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_Fine. Come back if you need something odd._";
	action = END_TALK;
